package net.esj.basic.dao.jdbc;

import javax.sql.DataSource;

import net.esj.basic.core.engine.datasource.SourceLocale;
import net.melon.jdbc.JdbcTemplate;


public class JdbcSourceLocale implements SourceLocale<JdbcTemplate>{
	
	private DataSource source;
	
	private JdbcTemplate jdbcTemplate;

	public void setSource(Object source) {
		this.source = (DataSource) source;
	}

	@Override
	public JdbcTemplate getSourceLocale() {
		if(jdbcTemplate == null){
			jdbcTemplate = new JdbcTemplate(source);
		}
		return jdbcTemplate;
	}
	
}
